package oop.ex1.actions;

import java.io.File;
import java.io.IOException;
//###############
//FILE : DiskAttributesFilter.java
//WRITER : Amir Wilf, wilfoa, 300007085
//WRITER : Daniel Acherkan, danithelion, 310116348
//EXERCISE : oop ex1 2011
//DESCRIPTION:
//A move action class - an action that moves a given file to a new location.
//###############
public class MoveAction extends DirectoryAction implements Action {
	/**
	 * A constructor for the class.
	 * @param Source the source directory of the file
	 * @param Target Target directory to move the file to
	 */
	public MoveAction(String source, String target) {
		super(source, target);
	}

	/**
	 * Moves a file to a new location
	 * @param file the file to be moved. 
	 */
	public void doAction(File file) throws IOException{
		CopyAction copyAction = new CopyAction(this._source,this._target);
		copyAction.doAction(file);
		file.delete();
	}
}
